package com.kjsdfgk.hjmdsf.ftmztlist.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.FragmentScope;

import javax.inject.Inject;

import com.kjsdfgk.hjmdsf.app.api.service.CommonService;
import com.kjsdfgk.hjmdsf.ftmztlist.mvp.contract.MZTListContract;

import io.reactivex.Observable;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 05/07/2020 22:13
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
@FragmentScope
public class MZTListModel extends BaseModel implements MZTListContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public MZTListModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    //    public final String[] CATEGORY_VALUE = {"女神", "嫩模", "极品", "网红", "气质", "尤物", "诱惑", "性感", "爆乳"};
    @Override
    public Observable<String> loadIndexImg(String tag, int page) {
        switch (tag) {
            case "最新": {
                String url = "https://www.meitulu.com/";
                if (page == 1 || true) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "女神": {
                String url = "https://www.meitulu.com/t/nvshen/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "极品": {
                String url = "https://www.meitulu.com/t/jipin/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "嫩模": {
                String url = "https://www.meitulu.com/t/nenmo/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "网红": {
                String url = "https://www.meitulu.com/t/wangluohongren/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "气质": {
                String url = "https://www.meitulu.com/t/qizhi/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "尤物": {
                String url = "https://www.meitulu.com/t/youwu/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "诱惑":{
                String url = "https://www.meitulu.com/t/youhuo/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "性感":{
                String url = "https://www.meitulu.com/t/xinggan/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "美胸":{
                String url = "https://www.meitulu.com/t/meixiong/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "爆乳":
            {
                String url = "https://www.meitulu.com/t/baoru/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
            case "长腿":
            {
                String url = "https://www.meitulu.com/t/changtui/";
                if (page == 1) {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url);
                    return result;
                } else {
                    Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                            .meiZiTuIndex(url + page + ".html");
                    return result;
                }
            }
        }
        String url = "https://www.meitulu.com/t/nvshen/";
        Observable<String> result = mRepositoryManager.obtainRetrofitService(CommonService.class)
                .meiZiTuIndex(url);
        return result;
    }
}